<clr-datagrid (clrDgRefresh)="refresh($event)">
  <clr-dg-column >
    <ng-container *clrDgHideableColumn="{hidden: true}">
      ID
    </ng-container>
  </clr-dg-column>
  <clr-dg-column [clrDgField]="'user.name'" *ngIf="listType === 'app'">
    <ng-container *clrDgHideableColumn="showState['用户名称']">
      用户名称
    </ng-container>
  </clr-dg-column>
  <clr-dg-column [clrDgField]="'app.name'" *ngIf="listType === 'user'">
    <ng-container *clrDgHideableColumn="showState['项目名称']">
      项目名称
    </ng-container>
  </clr-dg-column>
  <clr-dg-column>
    <ng-container *clrDgHideableColumn="showState['所属群组']">
      所属群组
    </ng-container>
  </clr-dg-column>
  <clr-dg-column>
    <ng-container *clrDgHideableColumn="showState['创建时间']">
      创建时间
    </ng-container>
  </clr-dg-column>
  <clr-dg-column
      *ngIf="
      authService.currentNamespacePermission.appUser.update ||
      authService.currentAppPermission.appUser.update ||
      authService.currentNamespacePermission.appUser.delete ||
      authService.currentAppPermission.appUser.delete ||
      authService.currentUser.admin"
  >
    <ng-container *clrDgHideableColumn="showState['操作']">
      操作
    </ng-container>
  </clr-dg-column>
  <clr-dg-row *ngFor="let appUser of appUsers" [clrDgItem]="appUser">
    <clr-dg-cell>{{appUser.id}}</clr-dg-cell>
    <clr-dg-cell *ngIf="listType === 'app'" class="copy">{{appUser.user.name}}</clr-dg-cell>
    <clr-dg-cell *ngIf="listType === 'user'" class="copy">{{appUser.app.name}}</clr-dg-cell>
    <clr-dg-cell>{{appUser.groupsName}}</clr-dg-cell>
    <clr-dg-cell>{{appUser.createTime | date:'yyyy-MM-dd HH:mm'}}</clr-dg-cell>
    <clr-dg-cell
      *ngIf="
      authService.currentNamespacePermission.appUser.update ||
      authService.currentAppPermission.appUser.update ||
      authService.currentNamespacePermission.appUser.delete ||
      authService.currentAppPermission.appUser.delete ||
      authService.currentUser.admin"
    >
    <button class="wayne-button text"
      *ngIf="
        authService.currentNamespacePermission.appUser.update ||
        authService.currentAppPermission.appUser.update ||
        authService.currentUser.admin"
        (click)="editAppUser(appUser)">
        编辑</button>
    <button class="wayne-button text"
        *ngIf="
        authService.currentNamespacePermission.appUser.delete ||
        authService.currentAppPermission.appUser.delete ||
        authService.currentUser.admin"
        (click)="deleteAppUser(appUser)">
        删除</button>
    </clr-dg-cell>
  </clr-dg-row>

  <wayne-paginate
    [(currentPage)]="currentPage"
    [total]="page.totalCount"
    [pageSizes]="[10, 20, 50]"
    (sizeChange)="pageSizeChange($event)"
  >
  </wayne-paginate>
</clr-datagrid>
